package com.koron.css2.clientCenter.impl;

import com.koron.css2.ServerInterface;
import com.koron.css2.clientCenter.bean.NoticeBean;
import com.koron.css2.clientCenter.mapper.NoticeMapper;
import com.koron.css2.serviceManage.bean.RequestBean;
import com.koron.css2.serviceManage.bean.UserInfoBean;
import com.koron.css2.serviceManage.utils.JsonUtils;
import com.koron.util.Constant;
import org.koron.ebs.mybatis.SessionFactory;
import org.swan.bean.MessageBean;
/**
 * 通知公告刪除
 * @author 杨嘉慧
 *
 */
public class NoticeDelete implements ServerInterface {

	@Override
	public MessageBean<?> exec(SessionFactory factory, UserInfoBean userInfo, RequestBean req) {
		try {
			NoticeBean notice = JsonUtils.objectToPojo(req.getData(), NoticeBean.class);
			NoticeMapper noticeMapper = factory.getMapper(NoticeMapper.class);
			noticeMapper.noticeDelete(notice.getId());
			MessageBean info = MessageBean.create(Constant.MESSAGE_INT_SUCCESS, "执行成功", void.class);
			return info;
		} catch (Exception e) {
			logger.error("通知公告列表刪除失败" + e.getMessage(), e);
			return MessageBean.create(Constant.MESSAGE_INT_FAIL, "执行失败", null);
		}
	}

}
